<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/lay-module/echarts/echarts.js"></script>
    <script type="text/javascript" src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
</head>

<body>
    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
    <div id="main" style="width: 600px;height:400px;"></div>


    <script>
        var chartDom = document.getElementById('main');
        var myChart = echarts.init(chartDom);
        $.ajax({
            "url":"http://localhost:8080/repair/workOrderPie",
            "data":{},
            "success":function (result){
              var i =result.data.workOrderPie[1].total/result.data.workOrderPie[0].total+result.data.workOrderPie[1].total;
                option = {
                title: {
                  text: '工单完成比对',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'item'
                },
                legend: {
                  top: '5%',
                  left: 'center'
                },
                color:['#ee6666', '#91cc75'],
                series: [
                  {
                    name: '工单',
                    type: 'pie',
                    radius: ['40%', '70%'],
                    avoidLabelOverlap: false,
                    itemStyle: {
                      borderRadius: 10,
                      borderColor: '#fff',
                      borderWidth: 2
                    },
                    label: {
                      show: false,
                      position: 'center'
                    },
                    emphasis: {
                      label: {
                        show: true,
                        fontSize: '40',
                        fontWeight: 'bold'
                      }
                    },
                    labelLine: {
                      show: false
                    },
                    
                    data: [
                             { value: result.data.workOrderPie[0].total, name: '未完成' },
                             { value: result.data.workOrderPie[1].total, name: '已完成' },
                    ]
                  }
                ]
                };


                myChart.setOption(option);
            },
            "dataType":"json"
        });



    </script>
</body>

</html>